<%@ page import="vo.Student" %>
<%@ page import="dao.AttendanceDao" %>
<%@ page import="java.util.List" %>
<%@ page import="vo.Attendance" %>
<%@ page import="vo.Course" %>
<%@ page import="dao.CourseDao" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>main</title>
    <link href="../resources/css/default.css" rel="stylesheet"/>
</head>
<body>
<%
    Student student = (Student) session.getAttribute("info");
%>
<div id="page" class="container">
    <div id="header">
        <div id="logo">
            <img src="../userImg/<%=student.getId()%>.jpeg"/>
            <h1><%=student.getName()%></h1>
        </div>
        <div id="menu">
            <ul>
                <li><a href="main.jsp">个人信息</a></li>
                <!--TODO 添加jsp页面链接-->
                <li><a href="course.jsp">课程信息</a></li>
                <li class="current_page_item"><a href="attendance.jsp">出勤信息</a></li>
                <li><a href="score.jsp">成绩信息</a></li>
                <li><a href="tuition_record.jsp">学费信息</a></li>
                <li><a onclick="return confirm('确认退出?');" href="../exit">退出登录</a></li>
            </ul>
        </div>
    </div>
    <div id="main">
        <div class="top">
            <h2>出勤信息</h2>
            <hr/>
        </div>
        <div class="table">
            <table width="800" frame="box" align="center">
                <tr>
                    <th height="35">课程</th>
                    <th>应到时间</th>
                    <th>状态</th>
                </tr>
                <%
                    try {
                        AttendanceDao ad = new AttendanceDao();
                        List<Attendance> list = ad.findWithStuId(student.getId());
                        for (Attendance c : list) {
                            CourseDao cd = new CourseDao();
                            Course course = cd.findWithId(c.getCourse_id());
                %>
                <tr>
                    <td height="35"><%=course.getName()%></td>
                    <td><%=c.getAttendance_time()%></td>
                    <td><%=c.getStatus()%></td>
                </tr>
                <%
                        }
                    }
                    catch (Exception e){
                        out.print(e);
                    }
                %>
            </table>
        </div>
    </div>
</div>
</body>
</html>